﻿<UserControl x:Class="BillsManager.Views.SearchBillsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:ViewModel="clr-namespace:BillsManager.ViewModels;assembly=BillsManager.ViewModels"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Loc="clr-namespace:BillsManager.Localization;assembly=BillsManager.Localization"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             d:DataContext="{d:DesignInstance Type=ViewModel:SearchBillsViewModel,
                                              IsDesignTimeCreatable=True}"
             mc:Ignorable="d">

    <UserControl.Resources>
        <!--<ResourceDictionary Source="/BillsManager.Views;component/Dictionaries/Styles.xaml" />-->
        <ResourceDictionary Source="/BillsManager.Views;component/Themes\Themes.xaml" />
    </UserControl.Resources>

    <UserControl.Background>
        <Binding Mode="OneTime" Source="{StaticResource View.Background}" />
    </UserControl.Background>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="{StaticResource View.MarginSize}" />
            <RowDefinition Height="Auto" />
            <!--<RowDefinition Height="Auto" />-->
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="{StaticResource View.MarginSize}" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="{StaticResource View.MarginSize}" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="{StaticResource View.MarginSize}" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="{StaticResource View.MarginSize}" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="{StaticResource View.MarginSize}" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <!--<Rectangle Grid.ColumnSpan="12"
                   Height="{StaticResource Separator.Size}"
                   Margin="0 1"
                   Fill="{StaticResource View.Foreground.Disabled}" />-->

        <TextBlock Grid.Row="1"
                   Margin="0 2"
                   Foreground="{StaticResource View.Title.Foreground}"
                   Text="{Loc:Translate Payment}" />

        <TextBlock Grid.Row="1"
                   Grid.Column="2"
                   Margin="0 2"
                   Foreground="{StaticResource View.Title.Foreground}"
                   Text="{Loc:Translate ReleaseDate}" />

        <TextBlock Grid.Row="1"
                   Grid.Column="4"
                   Margin="0 2"
                   Foreground="{StaticResource View.Title.Foreground}"
                   Text="{Loc:Translate DueDate}" />

        <TextBlock Grid.Row="1"
                   Grid.Column="6"
                   Margin="0 2"
                   Foreground="{StaticResource View.Title.Foreground}"
                   Text="{Loc:Translate Supplier}" />

        <CheckBox Grid.Row="3"
                  HorizontalAlignment="Left"
                  VerticalAlignment="Center"
                  Content="{Binding IsPaidFilterState}"
                  IsChecked="{Binding IsPaidFilterValue}"
                  IsThreeState="True" />

        <CheckBox Grid.Row="3"
                  HorizontalAlignment="Center"
                  VerticalAlignment="Center"
                  Content="{Loc:Translate NotPaid_toBills}"
                  Visibility="Hidden" />


        <StackPanel Grid.Row="3"
                    Grid.Column="2"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    Orientation="Horizontal">
            <CheckBox HorizontalAlignment="Left"
                      VerticalAlignment="Center"
                      IsChecked="{Binding UseReleaseDateFilter}" />
            <DatePicker HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        SelectedDate="{Binding ReleaseDateFilterValue}" />
        </StackPanel>

        <StackPanel Grid.Row="3"
                    Grid.Column="4"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    Orientation="Horizontal">
            <CheckBox HorizontalAlignment="Left"
                      VerticalAlignment="Center"
                      IsChecked="{Binding UseDueDateFilter}" />
            <DatePicker HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        SelectedDate="{Binding DueDateFilterValue}" />
        </StackPanel>

        <StackPanel Grid.Row="3"
                    Grid.Column="6"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    Orientation="Horizontal">
            <CheckBox HorizontalAlignment="Left"
                      VerticalAlignment="Center"
                      IsChecked="{Binding UseSupplierFilter}" />
            <ComboBox Grid.Row="1"
                      Grid.Column="2"
                      Width="Auto"
                      MinWidth="230"
                      HorizontalAlignment="Left"
                      VerticalAlignment="Center"
                      ItemsSource="{Binding AvailableSuppliers,
                                            IsAsync=True}"
                      SelectedValue="{Binding SelectedSupplier}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </StackPanel>

        <Button Grid.Row="3"
                Grid.Column="8"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Command="{Binding SendFilterCommand}"
                Content="{Loc:Translate DoFilter}"
                Focusable="False" />

        <Button Grid.Row="3"
                Grid.Column="10"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Command="{Binding ExitSearchCommand}"
                Content="{Loc:Translate ShowAll}"
                Focusable="False" />

        <!--<Rectangle Grid.Row="4"
                   Grid.ColumnSpan="12"
                   Height="{StaticResource Separator.Size}"
                   Margin="0 1"
                   Fill="{StaticResource View.Foreground.Disabled}" />-->

    </Grid>
</UserControl>
